const app = getApp();
var util = require('../../utils/util.js');
Page({
  data: {
    card: [{
      state: "正常使用",
      avatarUrl:"",
      num: "330241095"
    }],
    pageNum: 1,
    pageSize: 10
  },
  onLoad: function (options) {

  },
  onShow: function () {
    var that = this;
    let data = {
      bsoilUser: app.globalData.userUuid,
      pageNum: that.data.pageNum,
      pageSize: that.data.pageSize
    }
    util.requestGet("busiOil/my/find/by/cnd", data, function (res) {
      if (res.success) {
        console.log(res)
        var new_card = [];
        var obj = {};
        for (var i = 0; i < res.data.result.length; i++) {
          var obj = {};
          obj.num = res.data.result[i].bsoilCode;
          obj.avatarUrl = res.data.result[i].bsoilUserHead;
          if (res.data.result[i].bsoilStatus == 1) {
            obj.state = "等待审核";
          } else if (res.data.result[i].bsoilStatus == 2) {
            obj.state = "提交中石化";
          } else if (res.data.result[i].bsoilStatus == 3) {
            obj.state = "注册成功";
          } else if (res.data.result[i].bsoilStatus == 4) {
            obj.state = "邮寄中";
          } else if (res.data.result[i].bsoilStatus == 5) {
            obj.state = "正常使用";
          } else {
            obj.state = "审核不通过";
          }
          new_card.push(obj);
        }
        that.setData({ "card": new_card });
      }
    }, function (errData) {
      util.tipModal(that, "获取失败！");
    });
  },
  onHide: function () {

  },
  onUnload: function () {

  },
  addOilCard() {
    wx.navigateTo({
      url: '../addOilCard/addOilCard'
    })
  }
})